<extend name="zh_tw:Public:base" />
<block name="title">
    <title>美住 - 會員設置</title>
</block>
<block name="extendHead">
    <link rel="stylesheet" type="text/css" href="/Public/dist/Home/common_control.css?rev=bdf8875f9e52f651ec877dc7073586ed">
	<link rel="stylesheet" type="text/css" href="/Public/dist/Home/CustomerPage/customer.css?rev=cd47d17ebbe7fbb3621c66c75f223297">
</block>
<block name="document">
    <div id="doc" class="container-above-md">
        <include file="zh_tw:Public:Include_control_navbar" navbar-menu-customer="active" />
        <div id="doc-body" class="row">
            <include file="zh_tw:Public:Include_setting_side" doc-side-customer="active" />
             <div id="doc-center">
                <div class="content-panel">
                    <div class="content-panel-header" id="filterHeaderTabContainer">
                        <include file="zh_tw:Public:Include_customer_tab" booking-tab-setting="btn-primary" />
                    </div>
                </div>
                <if condition="$init eq 1">
                <div class="tag-list clearfix" id="tag-list">
                    <volist name="vipInfos" id="vipInfo">
                        <div class="tag-item">
                            <div class="tag-item-inner">
                                <div class="nowrap-content vip-item-left">{$vipInfo['name']}</div>
                                <div class="btn-sm btn-link vip-item-right set-vip-level" data-toggle="modal" data-id="{$vipInfo['id']}" data-target="#setVipLevelModal">設置</div>
                            </div>
                        </div>
                    </volist>

                    <div class="tag-item" id="div-add-vip" style="display: none;">
                        <button type="button" id="addVipLevel" class="pull-left btn-primary btn-raised btn-square glyphicon glyphicon-plus ulite-js-btn" data-toggle="modal" data-target="#vipLevelModal"></button>
                    </div>
                </div>
                </if>
                <if condition="($hasRight eq 1) AND ($init eq 0) ">
                    <a href="#" class="btn btn-raised btn-primary" style="margin-top: 10px;" data-toggle="modal" data-target="#vipInitModal">初始化</a>
                </if>
                
            </div>
            <!--end of doc-center-->
        </div>
        <!--end of doc body-->
    </div>
    <!--end of doc-->
    <!-- 添加會員等級模态框 -->    
    <div class="modal fade" id="vipLevelModal">
        <div class="modal-dialog modal-bg">
            <div class="modal-content">
               <div class="modal-header">
                    <button type="button" class="btn close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <div class="modal-title">添加會員等級</div>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal form-sm">
                        <div class="form-group">
                            <label class="col-xs-3 control-label">等級名稱：</label>
                            <div class="col-xs-5">
                                <input type="text" class="form-control" id="addVipLevelName" autocomplete="off" value="">
                            </div>
                            <div class="col-xs-4">
                                <div class="help-block"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">升級方式：</label>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10 font14" style="padding-top: 0px">
                                <label class="radio-inline">
                                    <input type="radio" id="add-on-update" name="add-update-way" checked="checked" value="1" />自動升級
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" id="add-off-update" name="add-update-way" value="0" />關閉自動升級
                                </label>
                            </div>
                        </div>
                        <div id="add-auto-update-label" class="form-group"  style="padding-left:70px">
                            <label class="col-xs-12 control-label" style="text-align: left;">您已選定按{$initInfo['level']?'消費總額':'入住次數'}作為自動升級規則：</label>
                        </div>
                        <div id="add-auto-update-input" class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="addTime" id="addTime" style="margin-top: 10px;" checked="checked" /></label>
                                    {$initInfo['level']?'消費總額':'入住次數'}達到{$initInfo['level']? $hotelDefaultSymbol :''}
                                    <input type="text" class="form-control input-discount" id="addLevelRule" autocomplete="off" value="">
                                    {$initInfo['level']?'':'次'}時，自動升級為該會員。
                                </div>
                            </div>
                        </div>
                        <div class="dotted-line"></div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label"> 會員優惠：</label>
                            <if condition="$initInfo['discount'] eq 1">
                                <label class="col-xs-7 control-label text-accent" style="text-align: left;">注意您房間的價格，會員減免后可能会出现为{$hotelDefaultSymbol}0的情况。</label>
                            </if>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="addDiscount" id="addHasDiscount" style="margin-top: 10px;" checked="checked"></label> 房價享受{$initInfo['discount']? $hotelDefaultSymbol :''}
                                    <input type="text" class="form-control input-discount" id="addDiscountRate" autocomplete="off" value="">{$initInfo['discount']?'':'折'}優惠
                                </div>
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="addDiscount" id="addNoDiscount" style="margin-top: 10px;"></label>
                                    無優惠
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <span id="add-vip-level-info" class="help-info"></span>
                    <button id="add-vip-level" type="button" data-share="{$initInfo['share']}" data-level="{$initInfo['level']}" data-discount="{$initInfo['discount']}" class="btn-primary btn-raised ulite-js-btn ulite-js-ripple-effect">保存</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 設置會員等級模态框 -->    
    <div class="modal fade" id="setVipLevelModal">
        <div class="modal-dialog modal-bg">
            <div class="modal-content">
               <div class="modal-header">
                    <button type="button" class="btn close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <div class="modal-title">修改會員等級</div>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal form-sm">
                        <div class="form-group">
                            <label class="col-xs-3 control-label">等級名稱：</label>
                            <div class="col-xs-5">
                                <input type="text" class="form-control" id="editVipLevelName" autocomplete="off" value="">
                            </div>
                            <div class="col-xs-4">
                                <div class="help-block"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">升級方式：</label>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10 font14" style="padding-top: 0px">
                                <label class="radio-inline">
                                    <input type="radio" id="edit-on-update" name="edit-update-way" value="1" />自動升級
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" id="edit-off-update" name="edit-update-way" value="0" />關閉自動升級
                                </label>
                            </div>
                        </div>
                        <div class="form-group" id="edit-auto-update-label" style="padding-left:70px">
                            <label class="col-xs-12 control-label" style="text-align: left;">
                                您已選定按{$initInfo['level']?'消費總額':'入住次數'}作為自動升級規則：
                            </label>
                        </div>
                        <div class="form-group" id="edit-auto-update-input" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="editTime" id="editTime" style="margin-top: 10px;"></label>
                                    {$initInfo['level']?'消費總額':'入住次數'}達到{$initInfo['level']? $hotelDefaultSymbol :''}
                                    <input type="text" class="form-control input-discount" id="editLevelRule" autocomplete="off" value="">
                                    {$initInfo['level']?'':'次'}時，自動升級為該會員。
                                </div>
                            </div>
                        </div>
                        <div class="dotted-line"></div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">會員優惠：</label>
                            <if condition="$initInfo['discount'] eq 1">
                                <label class="col-xs-7 control-label text-accent">
                                    注意您房間的價格，會員減免后可能会出现为{$hotelDefaultSymbol}0的情况。
                                </label>
                            </if>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="editDiscount" id="editHasDiscount" style="margin-top: 10px;"></label>房價享受{$initInfo['discount']? $hotelDefaultSymbol :''}
                                    <input type="text" class="form-control input-discount" id="editDiscountRate" autocomplete="off" value="8">
                                    {$initInfo['discount']?'':'折'}優惠
                                </div>
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="editDiscount" id="editNoDiscount" style="margin-top: 10px;"></label>
                                    無優惠
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <span id="edit-vip-level-info" class="help-info"></span>
                    <button id="edit-vip-level" type="button" data-share="{$initInfo['share']}" data-level="{$initInfo['level']}" data-discount="{$initInfo['discount']}"  class="btn-primary btn-raised ulite-js-btn ulite-js-ripple-effect">保存</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 初始化模态框 -->    
    <div class="modal fade" id="vipInitModal">
        <div class="modal-dialog modal-bg">
            <div class="modal-content">
               <div class="modal-header">
                    <button type="button" class="btn close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <div class="modal-title">初始化會員設置<small class="text-accent">(初始化機會只有壹次，請謹慎選擇。)</small></div>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal form-sm">
                        <div class="form-group">
                            <label class="col-xs-3 control-label">共享方式：</label>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="shareWay" value="0" />非共享(會員只在該客棧生效)</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="shareWay" value="1" />共享(會員在該掌櫃下所有客棧生效)</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">升級方式：</label>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="levelWay" value="0"/>次數升級(按照掌櫃設置的次數升級)</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="levelWay" value="1"/>金額升級(按照掌櫃設置的消費金額升級)</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">折扣方式：</label>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="discountWay" value="0"/>打折(原價打幾折)</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 0px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <div class="radio font14">
                                    <label ><input type="radio" name="discountWay" value="1"/>減免(原價減多少)</label>
                                </div>
                            </div>
                        </div>

                    </form>
                </div>
                <div class="modal-footer">
                    <span id="vip-init-info" class="help-info"></span>
                    <button type="button" id="confirmVipInit" class="btn-primary btn-raised ulite-js-btn ulite-js-ripple-effect" data-toggle="modal" data-target="#confirmVipInitModal">保存</button>
                </div>
            </div>
        </div>
    </div>
    <!--初始化確認的模态框-->
    <div class="modal" id="confirmVipInitModal" >
        <div class="modal-dialog modal-confirm">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">確認初始化:</h4>
                </div>
                <div class="modal-body">              
                <li>是否確認初始化？請確保明確選項意思後再確定！</li></div>
                <div class="modal-footer">
                    <span id="confirm-vip-init" class="help-info"></span>
                    <button type="button" id="cancel-init-vip">放棄</button>
                    <button type="button" id="init-vip-level">確認</button>
                </div>
            </div>
        </div>
    </div>
    <script type="text/html" id="templateVipList">
        <div class="tag-item">
            <div class="tag-item-inner">
                <div class="nowrap-content vip-item-left"></div>
                <div class="btn-sm btn-link vip-item-right set-vip-level" data-toggle="modal" data-target="#setVipLevelModal">設置</div>
            </div>
        </div>
    </script>
</block>
<block name="extendFootJs">
    <script type="text/javascript" src="/Public/dist/Home/common_control.js?rev=d2d95b4bdc49c83470f104e88d8458fc"></script>
    <script type="text/javascript" src="/Public/dist/Home/CustomerPage/vipSetting.js?rev=72624de0c3f54f7148a93e3965578386"></script>
</block>
